USE master
GO

IF EXISTS(SELECT name FROM sys.databases
WHERE name = 'Pharmacy')
DROP DATABASE Pharmacy
GO

create database Pharmacy
go

use Pharmacy


create table Encapsulation
(
ID int identity(1,1) not null,
Model nvarchar(50) not null,
[Output] nvarchar(50) not null,
[Image] nvarchar(50) not null,
CapsuleSize nvarchar(50) not null,
MachineDimension nvarchar(50) not null,
[Weight] nvarchar(50) not null
)
go

alter table Encapsulation
add constraint pk_ID primary key nonclustered(ID)
go

create proc spAddEncapsulation
@Name nvarchar(50),
@Out nvarchar(50),
@Image nvarchar(50),
@Size nvarchar(50),
@Dimension nvarchar(50),
@Weigth nvarchar(50)
as
begin
	insert into Encapsulation(Model,[Output],[Image],CapsuleSize,MachineDimension,[Weight]) values
	(@Name,@Out,@Image,@Size,@Dimension,@Weigth)
end
go

create proc spDeleteEncapsulation
@ID int
as
begin
	delete from Encapsulation where Encapsulation.ID = @ID
end
go


create proc spEditEncapsulation
@ID int,
@Name nvarchar(50),
@Out nvarchar(50),
@Image nvarchar(50),
@Size nvarchar(50),
@Dimension nvarchar(50),
@Weigth nvarchar(50)
as
begin
	update Encapsulation
	set Encapsulation.Model = @Name,Encapsulation.[Output]=@Out,Encapsulation.[Image] = @Image,	Encapsulation.CapsuleSize = @Size, Encapsulation.MachineDimension = @Dimension, Encapsulation.[Weight] = @Weigth
	where Encapsulation.ID = @ID
end
go

create proc spFindEncapsulation
@ID int
as
begin
	Select * from Encapsulation where Encapsulation.ID = @ID
end
go

create proc spLoadEncapsulation

as
begin
	select * from Encapsulation 
end
go

